package com.flnet.spsys.controller;

import com.flnet.spsys.entity.TbHome;
import com.flnet.spsys.service.ITbHomeService;
import com.flnet.spsys.utils.ResultJson;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import lombok.experimental.Accessors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Iterator;
import java.util.List;


@RestController
@RequestMapping("/home")
public class TbHomeController extends BaseController{
    @Autowired
    ITbHomeService iTbHomeService;

    @ApiOperation(value = "首页信息", notes = "首页用户信息")
    @ApiResponses(
            @ApiResponse(code = 200, message = "获取成功", response = ResultJson.class)
    )
    @PostMapping("/info")
    @CrossOrigin
    public Object getHome(TbHome tbHome){
        List<TbHome> tbHomeList = iTbHomeService.homeInfo(tbHome);
        if(tbHomeList == null){
            return ResultJson.failure("无信息",null);
        }
        for(Iterator itr=tbHomeList.iterator(); itr.hasNext();){
            Object str= itr.next();
            System.out.println(str);
        }
        return ResultJson.success(tbHomeList);
    }



}




















